function setCookie(a, c) {
    var b = 30;
    var d = new Date();
    d.setTime(d.getTime() + b * 24 * 60 * 60 * 1000);
    document.cookie = a + "=" + escape(c) + ";expires=" + d.toGMTString()
}

function getCookie(b) {
    var a, c = new RegExp("(^| )" + b + "=([^;]*)(;|$)");
    if(a = document.cookie.match(c)) {
        return unescape(a[2])
    } else {
        return null
    }
}


// JavaScript Document\
$(document).ready(function () {

    // banner轮播
    var swiper = new Swiper('.banner .swiper-container', {
        speed: 3000,
        autoplay: {
            delay: 2000,
            disableOnInteraction: false,
        },
        loop: false,
        resistanceRatio: 0,
        watchOverflow: true,
        pagination: {
            el: '.banner .swiper-pagination',
            clickable: true,
        },
        navigation: {
            nextEl: '.banner .swiper-button-next',
            prevEl: '.banner .swiper-button-prev',
        },
    });

    // nav  
    var navLi = $(".pg-header .nav ul li");
    navLi.mouseover(function () {
        $(this).addClass("active");
        $(this).find(".menu").stop().slideDown();
    })
    navLi.mouseleave(function () {
        $(this).removeClass("active");
        $(this).find(".menu").stop().slideUp();
    })

    //join
    $(".j-title").click(function () {
        $(this).toggleClass("active");
        $(this).next('.join-sec').slideToggle().parents(".join-item").siblings().find(".join-sec").slideUp();
    });

    // 投资声明滚动条
    var swiper = new Swiper('.tzsm-modal .swiper-container', {
        direction: 'vertical',
        slidesPerView: 'auto',
        freeMode: true,
        observer: true, //修改swiper自己或子元素时，自动初始化swiper

        observeParents: true, //修改swiper的父元素时，自动初始化swiper
        scrollbar: {
            el: '.tzsm-modal .swiper-scrollbar',
        },
        mousewheel: true,
    });


    if(!getCookie('iAccept')){
        $(".tzsm-modal").fadeIn(100);
    }
    $(".js-btn").on("click", function () {
        setCookie('iAccept',1);
        $(".tzsm-modal").fadeOut(400);
    });


    //注册切换
    $(".register-list").eq(0).show();
    $(".r-tabs a").on("click", function () {
        $(this).addClass("active").siblings().removeClass("active");
        $(".register-list").hide().eq($(this).index()).fadeIn();


    })



    $(".agree-btn").on("click", function () {
        $(".tzsm-modal").fadeIn(400);

    })


    // 申购弹出




    


    //百度分享
    var url = '';

    function seturl(a) {
        url = a
    }
    window._bd_share_config = {
        common: {
            bdText: '自定义分享内容',
            bdDesc: '自定义分享摘要',
            bdUrl: '自定义分享url地址',
            bdPic: '自定义分享图片',
            onBeforeClick: function (cmd, config) {
                return {
                    bdUrl: url
                }
            }
        },
        share: [{

        }],
        // slide: [{
        //         bdText: '333333333333'
        //     }

        // ],

        // selectShare: [{

        // }]
    }
    with(document) 0[(getElementsByTagName('head')[0] || body).appendChild(createElement('script')).src = 'http://bdimg.share.baidu.com/static/api/js/share.js?cdnversion=' + ~(-new Date() / 36e5)];









});